package handler

import (
	"car-trade-sys/model"
	"github.com/gin-gonic/gin"
	"strconv"
)

func OrderAdd(c *gin.Context) {
	cid, _ := strconv.Atoi(c.PostForm("cid"))
	ordertime := c.PostForm("ordertime")
	orderaddress := c.PostForm("orderaddress")
	orderpeople := c.PostForm("orderpeople")
	data := model.Order{
		Cid:          cid,
		OrderTime:    ordertime,
		OrderAddress: orderaddress,
		OrderPeople:  orderpeople,
	}
	model.DB.Create(&data).Debug()
	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "OK",
	})
	return
}
